﻿<!DOCTYPE html>
<html lang="zh">

<head resource>
    <meta charset="utf-8">
    <include file="../inc/meta.inc" />
    <include file="inc/head.inc" />
    <title>知识点</title>
</head>

<body>
    <div id="vapp" v-cloak>
        <loading v-if="loading_init"></loading>
        <aside class="sorts" v-if="true">
            <div class="bar">
                <div>
                    <el-button type="primary" icon="el-icon-edit" plain @click="sortsShow(true,null)">新增分类</el-button>
                    <help>拖动树形中的节点可以改变顺序</help>
                </div>
            </div>
            <el-tree :data="sorts" node-key="Kns_ID" ref="tree" :props="{children: 'children',label: 'Kns_Name'}"
                :default-expand-all="true" expand-on-click-node @node-drag-end="handleDragEnd"
                :expand-on-click-node="false" draggable empty-text="没有数据，请点击左上角“新增分类”" @node-click="nodeclick"
                v-loading="loading || loading_sumbit">
                <span class="custom-tree-node" slot-scope="{ node, data }">
                    <span class="tree-node draghandle" v-html="data.Kns_Name">
                    </span>
                    <icon v-if="sort_current && sort_current.Kns_ID==data.Kns_ID">&#xa048</icon>
                    <span class="sort_btn">
                        <el-tag :type="data.Kns_IsUse ? 'success' : 'info'" @click="sortstate(data,'Kns_IsUse')">
                            {{data.Kns_IsUse ? '启用' : '禁用'}} </el-tag>
                        <el-dropdown>
                            <span class="el-dropdown-link">
                                管理<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item>
                                    <el-link type="primary" size="mini" icon="el-icon-edit"
                                        @click="sortsShow(true,data)">
                                        编辑
                                    </el-link>
                                </el-dropdown-item>
                                <el-dropdown-item>
                                    <el-link type="danger" icon="el-icon-delete" @click="sortRemove(node, data)">
                                        删除
                                    </el-link>
                                </el-dropdown-item>

                            </el-dropdown-menu>
                        </el-dropdown>
                        <b class="el-icon-loading" v-if="loadingid==data.Kns_ID"></b>
                    </span>
                </span>
                </span>
            </el-tree>
            <el-dialog :title="sort_title" :visible.sync="sortsVisible" :before-close="()=>{}" :show-close="false">
                <el-form :model="sort_form" ref="sort_form" :rules="sort_rules">
                    <el-form-item label="分类名称" label-width="100px" prop="Kns_Name">
                        <el-input v-model="sort_form.Kns_Name"></el-input>
                    </el-form-item>
                    <el-form-item label="简介" label-width="100px" prop="Kns_Intro">
                        <el-input v-model="sort_form.Kns_Intro" type="textarea" :rows="2"></el-input>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="sortsVisible = false">取 消</el-button>
                    <el-button type="primary" @click="sortsEnter('sort_form')">确 定</el-button>
                </div>
            </el-dialog>
        </aside>
        <!--右侧内容列表-->
        <section class="list">
            <div class="toolsbar">
                <btngroup show="新增,删除" ref='btngroup' @add="knlShow(true,null)" @delete="deleteData"
                    path="AccountModify" width="600" height="600" :selects='selects' idkey='Kn_ID' table="knls">
                </btngroup>
                <query_panel :model="form" :loading="loading" @search="handleCurrentChange(1)">
                    <el-form-item label="">
                        <el-tag v-if="sort_current" closable @close="nodeclose">分类： {{sort_current.Kns_Name}}
                        </el-tag>
                        <el-input v-model="form.search" style="width:100px" clearable></el-input>
                    </el-form-item>
                </query_panel>
            </div>
            <div class="table">
                <el-table ref="knls" :stripe="true" :data="knls" tooltip-effect="dark"
                    @selection-change="val=>selects=val" @row-dblclick="row=>{knlShow(true,row);}">
                    <el-table-column type="selection" width="35"> </el-table-column>
                    <el-table-column type="index" width="50" align="center">
                        <template slot-scope="scope">
                            <span>{{(form.index - 1) * form.size + scope.$index + 1}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="标题">
                        <span slot-scope="scope" class="large" v-html="showsearch(scope.row.Kn_Title,form.search)">
                        </span>
                    </el-table-column>
                    <el-table-column label="分类" v-if="false">
                        <span slot-scope="scope">
                            {{scope.row.Kns_Name}}
                        </span>
                    </el-table-column>
                    <el-table-column label="启用" align="center" width="60">
                        <template slot-scope="scope">
                            <el-link :disabled="false" :type="scope.row.Kn_IsUse ? 'success' : 'info'"
                                @click="knlstate(scope.row,'Kn_IsUse')">
                                {{scope.row.Kn_IsUse ? '启用' : '禁用'}}
                            </el-link>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" show-overflow-tooltip width="120" align="center">
                        <el-button-group slot-scope="scope">
                            <el-link type="primary" plain icon="el-icon-edit" @click='knlShow(true,scope.row)'>修改
                            </el-link>
                            <el-popconfirm confirm-button-text='是的' cancel-button-text='不用' icon="el-icon-info"
                                icon-color="red" title="确定删除吗？" @confirm="$refs.btngroup.delete(scope.row.Kn_ID)">
                                <el-link type="danger" plain icon="el-icon-delete" slot="reference">删除
                                </el-link>
                            </el-popconfirm>
                        </el-button-group>
                    </el-table-column>
                </el-table>
            </div>
            <div id="pager-box">
                <el-pagination v-on:current-change="handleCurrentChange" :current-page="form.index" :page-sizes="[1]"
                    :page-size="form.size" :pager-count="12" layout="total, prev, pager, next, jumper" :total="total">
                </el-pagination>
            </div>
            <!--编辑内容-->
            <div v-show="knlVisible">
                <el-dialog :title="knl_title" :visible="true" :before-close="()=>{}" :show-close="false" :modal="false"
                    :destroy-on-close="true" class="knl_form" fullscreen>
                    <el-form :model="knl_form" ref="knl_form" :rules="knl_rules" label-width="60px">
                        <el-form-item label="标题" prop="Kn_Title">
                            <el-input v-model="knl_form.Kn_Title"></el-input>
                        </el-form-item>
                        <el-form-item label="分类" prop="Kns_ID">
                            <el-cascader style="width: 100%;" ref="sort"
                                @change="()=>$refs['sort'].dropDownVisible = false" v-model="knl_form.Kns_ID"
                                :options="sorts" separator="／" :props="{
                                children: 'children',
                                label: 'Kns_Name',
                                value: 'Kns_ID',
                                expandTrigger: 'hover',
                                checkStrictly: true
                            }" filterable>
                            </el-cascader>
                        </el-form-item>
                        <div class="Kn_Details">
                            <el-form-item label="内容" prop="Kn_Details">
                                <editor :content="knl_form.Kn_Details" model="general" ref="details_editor"
                                    upload="Knowledge" :dataid="knl_form.Kn_ID"
                                    @change="text=>knl_form.Kn_Details=text">
                                </editor>
                            </el-form-item>
                        </div>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="knlVisible = false">取 消</el-button>
                        <el-button type="primary" @click="knlEnter('knl_form')">确 定</el-button>
                    </div>
                </el-dialog>
            </div>
        </section>
    </div>
</body>

</html>